<template>
  <div class="my-wbox my-statistics">
    <el-tabs v-model="activeName">
      <el-tab-pane :label="item.name" v-for="(item, index) in tabData" :name="item.id">
        <MySearch v-if="activeName == item.id" :searchData="searchData" @listenClick="listenClick">
          <template #townId>
            <div class="lh32">
              <el-select v-model="townId" placeholder="请选择乡镇" clearable size="large" @change="onSlotSearch('townId')">
                <el-option :label="v.name" :value="v.areaCode || ''" v-for="v in townIdArr" :index="v.areaCode" />
              </el-select>
            </div>
          </template>

        </MySearch>
        <MyTable v-if="activeName == item.id" :tableData="tableData" @listenClick="listenClick">
          <template #default="{ slotData, slotColumn }">
            <div v-if="slotColumn.prop === 'resourceType'">
              {{ ['有奖举报', '用户举报'][slotData.resourceType - 1] }}
            </div>
            <div v-if="slotColumn.prop === 'approveFlag'">
              {{ ['-', '审批中'][slotData.approveFlag] }}
            </div>
            <div v-if="slotColumn.prop === 'delayFlag'">
              <div class="print" :class="slotData.delayFlag ? 'redPrint' : ''"></div>
            </div>
          </template>

        </MyTable>
      </el-tab-pane>
    </el-tabs>

    <!-- 分配窗口 -->
    <RecordFollow :isShowDialog="isShowDialog" :dialogData="dialogData"></RecordFollow>
    <!-- 市级 再次分配 -->
    <Again :isShowDialog="isShowAGDialog" :dialogData="dialogData"></Again>

    <!-- 驳回窗口 -->
    <Stop :isShowDialog="isShowBDialog" :dialogData="dialogData"></Stop>

    <!-- 回访窗口 -->
    <FollowUp :isShowDialog="isShowFDialog" :dialogData="dialogData">
    </FollowUp>

    <!-- 不予立案窗口 -->
    <Nolian :isShowDialog="isShowNDialog" :dialogData="dialogData">
    </Nolian>

    <!-- 退回窗口 -->
    <Back :isShowDialog="isShowKDialog" :dialogData="dialogData"></Back>

    <!-- 镇级 隐患分配  -->
    <Follow2Up v-if="(activeName == 2) && acceptId" :isShowDialog="isShow2Dialog" :dialogData="dialogData"
      :roleId="userInfo.roleId" :acceptId="acceptId">
    </Follow2Up>

    <!-- 镇级 再次分配  -->
    <Follow3Up v-if="(activeName == 6) && acceptId" :isShowDialog="isShow3Dialog" :dialogData="dialogData"
      :roleId="userInfo.roleId" :acceptId="acceptId">
    </Follow3Up>

    <!-- 有奖举报录入  -->
    <Awarded :isShowDialog="isShowAwDialog" />
    <!-- 延期申请窗口 -->
    <Delay :isShowDialog="isShowDeDialog" :dialogData="dialogData"></Delay>
  </div>
</template>
<script setup lang='ts'>
// @ts-ignore
import { ref, reactive, watch, computed } from 'vue'
import { useRouter } from 'vue-router'
import { FunTime } from '@/global/methods'
import http from '@/http/http'
import { ParentSearch, ParentTable } from '@/interface/index'
import { useStore } from '@/store'
import { SelectObj } from '@/interface/index'
import RecordFollow from './components/RecordFollow.vue'
import Bohui from './components/Bohui.vue'
import Back from './components/Back.vue'
import Stop from './components/Stop.vue'
import FollowUp from './components/FollowUp.vue'
import Nolian from './components/Nolian.vue'
import Follow2Up from './components/Follow2Up.vue'
import Follow3Up from './components/Follow3Up.vue'
import Delay from './components/Delay.vue'
import Awarded from './components/Awarded.vue'
import Again from './components/Again.vue'

import {
  getUserInfo,
  setSearchFamily,
  getSearchFamily,
  removeSearchFamily,
} from '@/global/session'
import { DangerSearch } from '@/views/extra/interface/interface'

import { ElMessage } from 'element-plus'
import { getNewAreaListApi } from '@/views/account/api/accountApi'
let searchInfo = getSearchFamily()//搜索条件

//监听加载
const loading = computed(() => {
  return store.getters['loading/getLoad']
})
const router = useRouter()
const store = useStore()

import { ColumnTable } from '@/interface/index'
import { Right } from '@element-plus/icons-vue'

// 搜索数据 yaohui
const search = reactive<DangerSearch>({
  townId: '',
  orderCode: '',
  unitName: '',
  reportUser: '',
  date: '',

  currentPage: 1,
  pageSize: 10

})

let tabData = ref<any[]>([])//选项卡
const searchData = reactive<ParentSearch>({
  searchForm: [
    {
      key: 'orderCode',
      styleType: 'input',
      label: '工单编号:',
      labelShow: true,
      value: '',
      placeholder: '可输入工单编号搜索',
      inputWidth: '200px',
    },
    {
      key: 'unitName',
      styleType: 'input',
      label: '举报单位名称:',
      labelShow: true,
      value: '',
      placeholder: '可输入举报单位名称搜索',
      inputWidth: '200px',
    },
    {
      key: 'reportUser',
      styleType: 'input',
      label: '举报人姓名:',
      labelShow: true,
      value: '',
      placeholder: '可输入举报人姓名搜索',
      inputWidth: '200px',
    },
    {
      key: 'date',
      styleType: 'date',
      type: 'daterange',
      startPlaceholder: '开始时间',
      endPlaceholder: '结束时间',
      label: '时间范围:',
      labelShow: true,
      value: '',
      format: 'YYYY-MM-DD',
      valueFormat: 'YYYY-MM-DD',
    },
    {
      key: 'townId',
      styleType: 'slot',
      label: '乡镇:',
      labelShow: true,
      value: '',
      hide(row: any): boolean {
        return (userInfo.roleId == '1' || userInfo.roleId == '2' || userInfo.roleId == '3')
      },
    },
    {
      key: 'orderStatus1',
      styleType: 'select',
      label: '工单状态',
      labelShow: true,
      value: '',
      placeholder: '请选择',
      data: [
        { label: '待派发', value: 1 },
        { label: '已办理', value: 2 },
        { label: '不予立案', value: 3 },
        { label: '已派发', value: 4 },
      ],
      hide(row: any): boolean {
        return (userInfo.roleId == '2' || userInfo.roleId == '3') && activeName.value == '9'
      },
    },
    {
      key: 'orderStatus',
      styleType: 'select',
      label: '工单状态',
      labelShow: true,
      value: '',
      placeholder: '请选择',
      data: [
        { label: '全部', value: '' },
        { label: '待签收', value: 1 },
        { label: '待办理', value: 2 },
        { label: '已办理', value: 4 },
        { label: '已延期', value: 5 },
        { label: '已退回', value: 6 },
        { label: '不予立案', value: 7 },
      ],
      hide(row: any): boolean {
        return (userInfo.roleId == '4' || userInfo.roleId == '6') && activeName.value == '9'
      },
    },
  ],
  searchBtn: [
    {
      name: 'onAwarded',
      type: 'primary',
      text: '有奖举报录入',
      hide(row: any): boolean {
        return (userInfo.roleId == '2' || userInfo.roleId == '3') && activeName.value == '1'
      },
    },
    {
      name: 'onExportAll', type: 'primary', text: '导出', hide(row: any): boolean {
        return (userInfo.roleId == '2' || userInfo.roleId == '3')
      },
    },
  ],
})
//封装的表格
const tableData = reactive<ParentTable>({
  //表格的一些数据
  listApi: '/manage/admin/reportRectify/pcPageQuery', //列表搜索接口
  listHttp: 'post', //列表接口方法
  search: {}, //搜索条件
  column: [
  ],
  columnBtn: {
    //操作按钮
    label: '操作',
    align: 'center',
    fixed: 'right',
    width: '150',
    btn: [
      // 所有
      { name: 'onDetail', text: '详情', },
    ],
  }, //表按钮
  index: true, //true 显示序号
  selection: true,
})

const time = FunTime('', 'YY-MM-DD-Zh')
let title = ref<string>('')
const activeName = ref<number | string>(1)//选项卡变化
watch(
  () => activeName.value,
  () => {
    onPreview()//预览
  }
)

let userInfo = reactive({ roleId: '', townId: '', countryId: '', roleAuth: '', townName: '', countryName: '' })
userInfo = JSON.parse(getUserInfo() as string)
const townId = ref<string>('')//乡镇
const countryId = ref<string>('')//村组

//预览数据
const onPreview = () => {
  searchData.searchForm[0].value = ''
  searchData.searchForm[1].value = ''
  searchData.searchForm[2].value = ''
  searchData.searchForm[3].value = ''
  searchData.searchForm[4].value = ''
  townId.value = ''

  if (userInfo.roleId == '1') {
    // 1、待派发，2、已派发，3、已办理，4、已退回，5、不予立案
    tabData.value = [
      {
        name: `待派发`,
        id: 1
      },
      {
        name: `已办理`,
        id: 3
      },
      {
        name: `不予立案`,
        id: 5
      },
    ]
    if (activeName.value == '1') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 1
      }

    } else if (activeName.value == '3') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 3
      }
    } else if (activeName.value == '5') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'orderCode', label: '子工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 5
      }
    }
  } else if (userInfo.roleId == '2' || userInfo.roleId == '3') {
    //市级管理员 (二级单位  2 3 )
    tabData.value = [
      {
        name: `待派发`,
        id: 1
      },

      {
        name: `已办理`,
        id: 3
      },
      {
        name: `已派发`,
        id: 4
      },
      {
        name: `不予立案`,
        id: 5
      },
      {
        name: `全部`,
        id: 9
      },
    ]

    if (activeName.value == '1') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 1
      }
    } else if (activeName.value == '3') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 3
      }
    } else if (activeName.value == '4') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 4
      }
    } else if (activeName.value == '5') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 5
      }
    } else if (activeName.value == '9') {
      tableData.column = [
        //表头
        { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
        { prop: 'resourceType', label: '数据来源', width: '120', align: 'left', slot: true },
        { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
        { prop: 'address', label: '举报问题地址', width: '200', align: 'left' },
        { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
        { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
        { prop: 'createTime', label: '举报提交时间', width: '180', align: 'left' },
      ]
      tableData.search = {
        reportStatus: 9
      }
    }
  } else if (userInfo.roleId == '4' || userInfo.roleId == '6') {
    // 1、待签收，2、已签收(未派发),3、已派发，4、已办理，5、已延期，6、已退回，7、不予立案
    //镇级管理员 (三级单位  4 6 )
    tabData.value = [
      {
        name: `待签收`,
        id: 1
      },
      {
        name: `待办理`,
        id: 2
      },
      {
        name: `已办理`,
        id: 4
      },
      {
        name: `已延期`,
        id: 5
      },
      {
        name: `已退回`,
        id: 6
      },
      {
        name: `不予立案`,
        id: 7
      },
      {
        name: `全部`,
        id: 9
      },
    ]

    tableData.column = [
      //表头
      { prop: 'acceptCode', label: '工单编号', width: '180', align: 'left' },
      { prop: 'orderCode', label: '子工单编号', width: '180', align: 'left' },
      { prop: 'resourceType', label: '数据来源', width: '120', slot: true },
      { prop: 'unitName', label: '被举报单位名称', align: 'left', width: '280', tooltip: true },
      { prop: 'address', label: '举报问题地址', width: '200', tooltip: true, align: 'left' },
      { prop: 'reportUser', label: '举报人姓名', width: '120', align: 'left' },
      { prop: 'userTel', label: '举报人电话', width: '150', align: 'left' },
      { prop: 'cityDispatchTime', label: '派单时间', width: '180', align: 'left' },
      { prop: 'requireTime', label: '规定完成时间', width: '180', align: 'left' },
      { prop: 'delayFlag', label: '延期标识', width: '100', align: 'center', slot: true },
    ]

    if (activeName.value == '1') {
      tableData.search = { reportStatusTown: 1 }

    } else if (activeName.value == '2') {


      tableData.search = { reportStatusTown: 2 }

    } else if (activeName.value == '4') {

      tableData.search = {
        reportStatusTown: 4
      }
    } else if (activeName.value == '5') {

      tableData.search = {
        reportStatusTown: 5
      }
    } else if (activeName.value == '6') {

      tableData.search = {
        reportStatusTown: 6
      }
    } else if (activeName.value == '7') {

      tableData.search = {
        reportStatusTown: 7
      }
    } else if (activeName.value == '9') {

      tableData.search = {
        reportStatusTown: 9
      }
    }

  }

}
//导出
const onExport = () => {
  let url = ''//接口地址
  if (userInfo.roleId == '1' || userInfo.roleId == '2' || userInfo.roleId == '3') {
    //市
    if (activeName.value == '1') {
      //当日统计表
      url = '/manage/admin/report/exportMuniCurr'
    } else {
      //全部统计表
      url = '/manage/admin/report/exportMuniTotal'
    }
  } else if (userInfo.roleId == '4') {
    //镇
    if (activeName.value == '1') {
      //累计上报表
      url = '/manage/admin/report/exportEachCountryTotal'
    } else if (activeName.value == '2') {
      //摸排人员当日统计表
      url = '/manage/admin/report/exportTownUserCurr'
    } else if (activeName.value == '3') {
      //摸排人员累计上报表
      url = '/manage/admin/report/exportTownUserTotal'
    } else if (activeName.value == '4') {
      //摸排人员注册明细表
      url = '/manage/admin/report/exportTownUserDetail'
    } else {
      //每个村累计上报表--不含组
      url = '/manage/admin/report/exportNoGroupTotal'
    }

  } else if (userInfo.roleId == '5') {
    //乡
    if (activeName.value == '1') {
      //摸排人员当日统计表
      url = '/manage/admin/report/exportCountryUserCurr'
    } else if (activeName.value == '2') {
      //摸排人员累计上报表
      url = '/manage/admin/report/exportCountryUserTotal'
    } else {
      //摸排人员注册明细表
      url = '/manage/admin/report/exportCountryUserDetail'
    }
  }

}

onPreview()//预览

//插槽的搜索  keySlot传入对应的key
const onSlotSearch = (keySlot: string) => {
  let obj = searchData.searchForm?.find((t) => t.key === keySlot)
  if (obj) {
    if (keySlot === 'townId') {
      obj.value = townId.value
    }
    // isSearch.value = !isSearch.value //是否触发搜索
  }
}
//列表搜索
const onSearch = (val?: any) => {
  if (userInfo.roleId == '4' || userInfo.roleId == '6') {
    val.reportStatusTown = activeName.value
  } else {
    val.reportStatus = activeName.value
  }
  if (val.date) {
    val.startTime = val.date[0]
    val.endTime = val.date[1]
  }
  if (val.orderStatus1) {
    val.orderStatus = val.orderStatus1
  }
  delete val.orderStatus1
  console.log(val)
  tableData.search = val
  //刷新表格
  store.commit('refresh/setRefresh', !store.getters['refresh/getRefresh'])
  //yaohui
  //把搜索条件记录一下
  setSearchFamily(JSON.stringify(tableData.search))
}
//列表搜索重置 清空插槽里面的内容
const onSearchClear = (val: any) => {
  townId.value = ''
  removeSearchFamily() //清除搜索条件
  onSearch(val)
}
// 有奖举报录入
const onAwarded = () => {
  isShowAwDialog.value = !isShowAwDialog.value
}

//详情
const onDetail = (row: any) => {
  //yaohui
  //把搜索条件记录一下
  setSearchFamily(JSON.stringify(tableData.search))
  router.push({
    name: 'dangerDetail',
    query: { id: row.id, reportStatus: activeName.value, approveFlag: row.approveFlag, isXiangqing: 1 },
  })
}
// 隐患分配
const onFollowRecord = (row: any) => {
  if (row) {
    dialogData.value = row.id
    isShowDialog.value = !isShowDialog.value
  } else {
    if (selection.value.length == 0) {
      ElMessage({ type: 'warning', message: '请选择需要分配的隐患' })
    } else {
      let idArr: any = []
      selection.value.map((item: any) => {
        idArr.push(item.id)
      })
      dialogData.value = idArr
      isShowDialog.value = !isShowDialog.value

    }

  }
}
// 镇级隐患分配
const onFollow2 = (row: any) => {
  acceptId.value = row.acceptId
  dialogData.value = row.id
  setTimeout(() => {
    isShow2Dialog.value = !isShow2Dialog.value

  }, 500);

}
// 镇级再次隐患分配
const onFollow3 = (row: any) => {
  acceptId.value = row.acceptId
  dialogData.value = row.id
  setTimeout(() => {
    isShow3Dialog.value = !isShow3Dialog.value

  }, 500);

}

// 延期申请
const onDelay = (row: any) => {
  dialogData.value = row.id
  isShowDeDialog.value = !isShowDeDialog.value

}

// 不予立案
const onNotCase = (row: any) => {
  dialogData.value = row.id
  isShowNDialog.value = !isShowNDialog.value
}
// 市级 再次分配
const onAglign = (row: any) => {
  dialogData.value = row.id
  isShowAGDialog.value = !isShowAGDialog.value
}
// 退回
const onBack = (row: any) => {
  dialogData.value = row.id
  isShowKDialog.value = !isShowKDialog.value
}

//分页 一页多少条数
const onListenPageSize = (val: number) => {
  tableData.search.pageSize = val
}
//分页  当前页码
const onListenPageIndex = (val: number) => {
  tableData.search.currentPage = val
}

const isShowBDialog = ref<boolean>(false) //数据转移弹窗是否出现
const isShowDialog = ref<boolean>(false) //数据转移弹窗是否出现
const isShowAwDialog = ref<boolean>(false) //数据转移弹窗是否出现
const isShowNDialog = ref<boolean>(false) //不予立案弹窗是否出现 
const isShow2Dialog = ref<boolean>(false) //不予立案弹窗是否出现 
const isShow3Dialog = ref<boolean>(false) //不予立案弹窗是否出现 
const isShowDeDialog = ref<boolean>(false) //不予立案弹窗是否出现 
const isShowKDialog = ref<boolean>(false) //不予立案弹窗是否出现
const isShowFDialog = ref<boolean>(false) //数据转移弹窗是否出现 
const isShowAGDialog = ref<boolean>(false) //数据转移弹窗是否出现 
const dialogData: any = ref([]) //传给弹窗的数据
const acceptId: any = ref('')
const selection: any = ref([])
//数据转移
const onTransfer = () => {
  if (selection.value.length == 0) {
    ElMessage({ type: 'warning', message: '请选择需要转移的户主' })
  } else {
    isShowDialog.value = !isShowDialog.value
    const arr = selection.value.map((item: any) => item.id)
    dialogData.value = arr
  }
}
const onSelectionChange = (val: any) => {
  selection.value = val
}


// 记录回访
const onFollowUp = (row: any) => {
  dialogData.value = row.id
  isShowFDialog.value = !isShowFDialog.value
}
//导出
const onExportAll = () => {
  store.commit('loading/setLoad', true)
  let params = tableData.search
  onFunApi('/manage/admin/reportRectify/export', params)
}
const onFunApi = async (url: string, params: any) => {
  try {
    let res = await http.post(url, params)
    if (res?.code === 0 && res.data) {
      window.open(res.data)
    }
    // store.commit('loading/setLoad', false)
  } finally {
    store.commit('loading/setLoad', false)
  }
}

//定义方法对象 注意定义的方法 必须在上面已经申明 所以建议objFun申明和 listenClick方法 写在页面最下面
const objFun = {
  onDetail: onDetail,
  onAwarded: onAwarded,
  onSearch: onSearch,
  onFollowRecord: onFollowRecord,
  onFollow2: onFollow2,
  onFollow3: onFollow3,
  onDelay: onDelay,
  onNotCase: onNotCase,
  onAglign: onAglign,
  onBack: onBack,
  onSearchClear: onSearchClear,
  onListenPageSize: onListenPageSize,
  onListenPageIndex: onListenPageIndex,
  onTransfer: onTransfer,
  onSelectionChange: onSelectionChange,
  onFollowUp: onFollowUp,
  onExportAll: onExportAll,
}
// 监听子级表格  传过来的方法禁用
const listenClick = (name: string, val: any) => {
  console.log(name)
  objFun[name](val)
}

//获取所有乡镇
let townIdArr = ref<SelectObj[]>([]) //乡镇
const onAreaList = async () => {
  try {
    let res = await getNewAreaListApi()
    if (res?.code === 0) {
      townIdArr.value = res.data
    }
  } catch { }
}
// yaohui

onAreaList()

//详情页返回的搜索条件保留
const searchTiaojian = () => {
  if (searchInfo) {
    console.log('123', searchInfo)

    let searchObj = JSON.parse(searchInfo)
    activeName.value = searchObj.reportStatusTown || searchObj.reportStatus


    setTimeout(() => {

      searchData.searchForm[0].value = searchObj.orderCode
      searchData.searchForm[1].value = searchObj.unitName
      searchData.searchForm[2].value = searchObj.reportUser
      searchData.searchForm[3].value = searchObj.date
      searchData.searchForm[4].value = searchObj.townId
      townId.value = searchObj.townId

      onSearch(searchObj)
    }, 800);


  }
}
searchTiaojian()



</script>
<style scoped lang='scss'>
.my-statistics {
  position: relative;

  .print {
    width: 10px;
    height: 10px;
    background-color: green;
    border-radius: 50%;
  }

  .redPrint {
    background-color: red;
  }

  &__btn {
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 9999;
  }

  :deep(.el-tabs__item) {
    height: 60px;
    line-height: 40px;
    font-size: 15px;
  }

  :deep(.el-tabs__item.is-active) {
    font-weight: bold;
  }
}

.my-loading {
  width: 100%;
  height: calc(100vh - 200px);
}

.my-table {
  width: 100%;
  border: 1px solid #ebeef5;

  :deep(th.el-table__cell) {
    background: #f2f2f2;
    color: #111;
  }
}

.my-title01 {
  text-align: center;
  margin-bottom: 10px;
}
</style>